package tr.edu.metu.is.mega.server.service;

import java.util.List;

import tr.edu.metu.is.mega.client.service.GwtCourseService;
import tr.edu.metu.is.mega.common.dto.CourseDTO;
import tr.edu.metu.is.mega.common.dto.CourseStudentDTO;
import tr.edu.metu.is.mega.common.dto.TeamDTO;
import tr.edu.metu.is.mega.server.business.CourseManager;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;

/**
 * Implementation of GWT course service.
 */
public class GwtCourseServiceImpl extends RemoteServiceServlet implements GwtCourseService {

    private static final long serialVersionUID = 8633831570963747680L;

    private final CourseManager manager;

    /**
     * Default constructor.
     */
    public GwtCourseServiceImpl() {
        manager = new CourseManager();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public CourseDTO createCourse(CourseDTO course) {
        return manager.createCourse(course);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public CourseDTO updateCourse(CourseDTO course) {
        return manager.updateCourse(course);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void deleteCourse(CourseDTO course) {
        manager.deleteCourse(course);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public List<CourseDTO> getCourses(CourseDTO filter) {
        return manager.getCourses(filter);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public CourseDTO updateTeam(TeamDTO team) {
        return manager.updateTeam(team);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public boolean exportToGoogleCalendar(String userName, String password, CourseDTO course) {
        return manager.exportToGoogleCalendar(userName, password, course);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public List<CourseStudentDTO> pullStudentsFromMETUOnline(CourseDTO course) {
        return manager.pullStudentsFromMETUOnline(course);
    }

}
